#include <fcntl.h>
#include <sys/stat.h>
#include <semaphore.h>

#define LINE_SIZE 256
#define NUM_LINE 16

#define SHM_KEY ftok("/home/ajole/OS/exp2/shm_com_sem.h", 'A') // generate the key

// 用于创建信号量时的识别id
const char *queue_mutex = "queue_mutex";
const char *queue_empty = "queue_empty";
const char *queue_full = "queue_full";

// 生产者消费者公用的缓冲区，含读写指针
// line_write和line_read,以及缓冲数据区buffer[NUM_LINE][LINE_SIZE], buffer[X]
// 指向第X行信息，buffer[X][Y]指向X行信息的第Y个字符

struct shared_mem_st {
    char buffer[NUM_LINE][LINE_SIZE];
    int line_write;
    int line_read;
    int should_exit;
};